from pyspark import SparkConf, SparkContext

if __name__ == '__main__':
    # 构建SparkConf对象
    conf = SparkConf().setAppName("test").setMaster("local[*]")
    # 构建SparkContext执行环境入口对象
    sc = SparkContext(conf=conf)

    rdd = sc.parallelize([1, 2, 4, 6, 8, 9, 3], 3)

    rdd.saveAsTextFile("hdfs://node1:8020/output/1")
    """
    saveAsTextFile: 将数据输出到文本文件，支持本地系统以及HDFS
    """
